package com.huilian.iotbox.data.enums;

import lombok.Getter;

@Getter
public enum ConsumeRecordStatusEnum {
    UPPING(0,"进行中"),
    SUCCESS(1,"成功"),
    FAIL(2,"失败"),
    WAIT_CHARGING(5, "等待充电"),
    CHARGING(6, "充电中"),
    CHARGE_COMPLETE(7, "充电完成"),
    CHARGE_FAILED_FULL_REFUND(8, "充电失败，全部退款"),
    CHARGE_COMPLETED_PARTIAL_REFUND(9, "充电完成，部分退款"),
    ;

    private Integer code;

    private String desc;

    ConsumeRecordStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String formatDesc(Integer code){
        ConsumeRecordStatusEnum[] values = ConsumeRecordStatusEnum.values();
        String desc = null;
        for (int i = 0; i < values.length; i++) {
            if (values[i].code.compareTo(code) == 0){
                desc = values[i].desc;
                break;
            }
        }
        return desc;
    }
}
